/** @file               sw_mem.h
 *  @copyright          Copyright (C) 2006-2026 flyfish (tenggui_fu@126.com)
 *  @brief              This file is part of the swallow library
 *  @author             $Author: flyfish $
 *  @version            $Rev: 385 $
 *  @date               $Date: 2016-12-22 00:12:05 +0800 (周四, 22 12月 2016) $
 */
#ifndef __SW_MEM_H__
#define __SW_MEM_H__

#ifdef __cplusplus
extern "C" {
#endif

typedef SW_VOID *(*SW_MEM_ALLOC_PROC)(SW_UINT32);
typedef SW_VOID *(*SW_MEM_REALLOC_PROC)(SW_VOID *, SW_UINT32);
typedef SW_RET (*SW_MEM_FREE_PROC)(SW_VOID *);
typedef SW_RET (*SW_MEM_COPY_PROC)(SW_VOID *, const SW_VOID *, SW_UINT32);
typedef SW_RET (*SW_MEM_FILL_PROC)(SW_VOID *, SW_UINT8, SW_UINT32);

SW_API SW_RET SW_InitMemAPI(SW_VOID);
SW_API SW_RET SW_RunMemAPI(SW_VOID);
SW_API SW_RET SW_StopMemAPI(SW_VOID);
SW_API SW_RET SW_ExitMemAPI(SW_VOID);
SW_API SW_VOID *SW_MemAlloc(SW_UINT32 memLen);
SW_API SW_VOID *SW_MemRealloc(SW_VOID *pMem, SW_UINT32 memLen);
SW_API SW_RET SW_MemFree(SW_VOID *pMem);
SW_API SW_RET SW_MemCopy(SW_VOID *pDstMem, const SW_VOID *pSrcMem, SW_UINT32 copyLen);
SW_API SW_RET SW_MemFill(SW_VOID *pMem, SW_UINT8 value, SW_UINT32 memLen);
SW_API SW_CMP SW_MemCmp(const SW_VOID *pMem1, const SW_VOID *pMem2, SW_UINT32 memLen);
SW_API SW_CHAR *SW_StrDup(const SW_CHAR *pStr);
SW_API SW_VOID **SW_MemAlloc2D(SW_UINT32 row, SW_UINT32 col, SW_DATA_TYPE type);
SW_API SW_RET SW_MemFree2D(SW_VOID **pMem);

#ifdef __cplusplus
}
#endif

#endif

